package unknow;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.map.UpperKeyMap;

/**
 * @author 李栋
 * @version 1.0.0
 * @className JavaTest.java
 * @createTime 2021年06月14日 10:24:00
 */
public class JavaTest {

    private static final Logger logger = LoggerFactory.getLogger(JavaTest.class);

    /**
     * for 循环中 return
     */
    @Test
    public void returnTest() {
        for (int j = 0; j < 10000; j++) {
            if (j == 3) {
                return;
            }
            logger.info(String.valueOf(j));
        }
        logger.info("return 测试");
    }

    @Test
    public void testOne() {
        final String strOne = "test";
        logger.info(strOne);
    }

    @Test
    public void testTwo() {
        try {
            methodOne();
        } catch (Exception e) {
            logger.error("error occur:", e);
        }
    }

    private void methodOne() throws Exception {
        throw new Exception("测试异常");
    }

    /**
     * Map 中 key 统一转大写
     */
    @Test
    public void testThree() {
        List<Map<String, Object>> map = new ArrayList<>();
        Map<String, Object> map1 = new UpperKeyMap();
        map1.put("a", 1);
        map1.put("b", 2);
        map1.put("c", 3);
        map.add(map1);
        List<Map<String, Object>> list = new ArrayList<>(map);
        logger.info(list.toString());
    }




}
